﻿layui.use(['form', 'layedit', 'laydate'], function () {
    var form = layui.form
    , layedit = layui.layedit
    , laydate = layui.laydate
	,layer = parent.layer === undefined ? layui.layer : parent.layer
	,laypage = layui.laypage,
		$ = layui.jquery;


    //自定义验证规则
    form.verify({
        title: function (value) {
            if (value.length <= 0) {
                return '名字不能为空';
            }
        }

    });

    function AddSubmit(data) {
        $.ajax({
            type: "post",
            url: "/Invitework/Invite",
            data: data.field,
            dataType: "json",
            success: function (result) {
                if (result.State == 1)
                    layer.alert(result.Message, { icon: 1, time: 1.5 * 1000 });
                else
                    layer.msg(result.Message, { icon: 7, time: 1.5 * 1000 });
            }
        });
    };



    //监听提交
    form.on('submit(demo1)', function (data) {

        AddSubmit(data);

        return false;
    });


});